Skip to content

feat(alarm): Introduce KINDOF_NO_ATTACK_WARNING#2862

Open
githubawn wants to merge 4 commits into
TheSuperHackers:mainfrom
githubawn:fix/cargo-alarm
Open

feat(alarm): Introduce KINDOF_NO_ATTACK_WARNING#2862
githubawn wants to merge 4 commits into
TheSuperHackers:mainfrom
githubawn:fix/cargo-alarm

Conversation

@githubawn

@githubawn githubawn commented Jul 8, 2026

Copy link
Copy Markdown

This PR introduces the KINDOF_NO_ATTACK_WARNING flag. Assigning this KindOf to a unit prevents it from triggering EVA or Radar notifications for the player.

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces the KINDOF_NO_ATTACK_WARNING KindOf flag that, when assigned to a unit, suppresses the under-attack radar and EVA alert generated by Object::attemptDamage. The implementation is applied symmetrically across both Generals/ and GeneralsMD/ code trees.

  • A single guard !isKindOf(KINDOF_NO_ATTACK_WARNING) is added before calling TheRadar->tryUnderAttackEvent(this) in both game variants — correctly gating all audio, UI-message, and EVA notifications that stem from that function.
  • The new enum entry and its string-table counterpart are added in matching positions in both KindOf.h and KindOf.cpp, and GeneralsMD adds an extra KINDOF_UNUSED_1 padding slot to maintain a specific KINDOF_COUNT alignment.

Confidence Score: 5/5

Safe to merge; the guard is a simple boolean addition to an existing condition chain with no risk of side-effects on other code paths.

The change correctly gates TheRadar->tryUnderAttackEvent — which internally handles both radar events and EVA calls — with a single cheap isKindOf check. The enum entry and its string-table counterpart are added in matched positions in both game trees.

No files require special attention.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Include/Common/KindOf.h Adds KINDOF_NO_ATTACK_WARNING enum entry in correct position before KINDOF_COUNT; follows existing alignment conventions.
Generals/Code/GameEngine/Source/Common/System/KindOf.cpp Adds NO_ATTACK_WARNING to the string lookup table in the correct matching position; no issues.
Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp Adds !isKindOf(KINDOF_NO_ATTACK_WARNING) guard before tryUnderAttackEvent; logically correct and the if-body remains on its own line per codebase style.
GeneralsMD/Code/GameEngine/Include/Common/KindOf.h Adds KINDOF_NO_ATTACK_WARNING and KINDOF_UNUSED_1; the two new entries have inconsistent tab alignment for their ///< comments relative to each other.
GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp Adds NO_ATTACK_WARNING and UNUSED_1 strings matching the enum order; no issues.
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp Mirrors the Generals guard addition; logically correct, consistent with existing null-check pattern for getControllingPlayer().

Reviews (7): Last reviewed commit: "Add unused KindOf padding bit to fix dup..." | Re-trigger Greptile

Comment thread GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp Outdated
Preprocessor #if/#endif directives are not allowed indentation in this
codebase; align with existing convention in the file.
@WWB2-account

WWB2-account commented Jul 9, 2026

Copy link
Copy Markdown

From my perspective (which is one from modding), I think this fix is not exactly what's needed. Hardcoding it seems the wrong way to go about it. Mods can simply make the SDZ cargo plane untargettable if they want to. It's very unlikely your opponent intercepts the plane before it drops the cash anyway.

If the committee deems it absolutely necessary to have targettable SDZ planes (for the sake of distracting AA), I think a better idea is to make a system that can be applied to any object that suppresses radar alarms, like a new KindOf, then apply it to the Cargo Plane. Yes, that would be a lot of work for a single object. Yes, it would require modded to update a single object, but you've also given them an entirely new tool in their toolbox.

@Skyaero42

Copy link
Copy Markdown

Agree with @WWB2-account

People are trying to come up with a solution (I think this is the third PR that is trying to 'fix' this?) without first consulting / discussing what the preferable outcome should be: When (in the broadest sense) should an alarm be (re)fired.

@xezon

xezon commented Jul 9, 2026

Copy link
Copy Markdown

This is a big hack indeed. It totally falls apart when the Object template name is changed.

@xezon

xezon commented Jul 13, 2026

Copy link
Copy Markdown

I think a better idea is to make a system that can be applied to any object that suppresses radar alarms, like a new KindOf, then apply it to the Cargo Plane.

I agree with this approach for this problem.

Vote for close.

@Skyaero42

Copy link
Copy Markdown

I think a better idea is to make a system that can be applied to any object that suppresses radar alarms, like a new KindOf, then apply it to the Cargo Plane.

I agree with this approach for this problem.

Vote for close.

Agree

@githubawn

Copy link
Copy Markdown
Author

I can rework this with the new KindOf approach.

@githubawn githubawn marked this pull request as draft July 14, 2026 18:32
@githubawn githubawn changed the title fix(alarm): Disable radar alarms for USA cargo planes feat(alarm): Introduce KINDOF_NO_ATTACK_WARNING Jul 15, 2026
@githubawn

githubawn commented Jul 15, 2026

Copy link
Copy Markdown
Author

Reworked PR

@githubawn githubawn marked this pull request as ready for review July 15, 2026 18:21
@Skyaero42

Copy link
Copy Markdown

a) this requires changes to the ini, which won't be distributed in our retail release, hence problem still persists.
b) this solution only offers an on/off option, not a reduced option. For example a spectre will still trigger high amounts of alerts.

I stick by my original comment: a solution cannot be formulated if the desired outcome is not clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants